package com.kma.summer2012.facade;

/**
 * Created by IntelliJ IDEA.
 * User: HP
 * Date: 26.02.13
 * Time: 2:52
 * To change this template use File | Settings | File Templates.
 */

import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateAdapter extends XmlAdapter<String, Date> {
    //  private DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:MM");
    private DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    //DATE_FORMAT_FULL = dd/MM/yyyy HH:mm:ss
    //DateTimeFormat.getFormat(ConstantsHolder.getConstants().DATE_FORMAT_FULL()).parse(startDate);
    @Override

    public Date unmarshal(String v) throws Exception {
        return format.parse(v);
    }

    @Override
    public String marshal(Date v) throws Exception {
        return format.format(v);
    }
}
